
global delta_TS beta_TS rho_TS THETA_TS

beta_TS = 0.5030;
delta_TS = 0.9880;
rho_TS = 1.1051;

% Iterate over a range of values for THETA and store separately the actual
% and the predicted outcomes of a naive household. 
THETA_values = [];
for THETA = (0.035:0.0025:0.065)
    THETA_values = [THETA_values THETA];
    THETA_TS = THETA;
    
    batchmsm20160515dbr_naif1_singleRun;
    load('simulation_output/hs_xz_beta0_rho0_naif1_dbr_singleRunsim')
    suffix = strcat('avgZ',num2str(THETA*10000),'_naif');
    mydata.(suffix) = avgZ_;
    suffix = strcat('avgX',num2str(THETA*10000),'_naif');
    mydata.(suffix) = avgX_;
    suffix = strcat('avgTC',num2str(THETA*10000),'_naif');
    mydata.(suffix) = avgTC_;
    
    batchmsm20160515dr_exp_singleRun;
    load('simulation_output/hs_xz_exp_rho0_dr_singleRunsim')
    suffix = strcat('avgZ',num2str(THETA*10000),'_TC');
    mydata.(suffix) = avgZ_;
    suffix = strcat('avgX',num2str(THETA*10000),'_TC');
    mydata.(suffix) = avgX_;
    suffix = strcat('avgTC',num2str(THETA*10000),'_TC');
    mydata.(suffix) = avgTC_;
    
end
mydata.THETA_grid = THETA_values;

mydata.age = age_;
mydata.alpha = alpha;
mydata.avgIncome = avgIncomeOverLifecycle;
mydata.avgY = avgY_;
mydata.delta = delta_TS;
mydata.effhh_size = effhh_size_;
mydata.meanhhs = mean(effhh_size_);
mydata.R = R;
mydata.rho = rho_TS;
mydata.beta = beta_TS;
mydata.zpen_eval = zpen_eval(2,:);

survival = ones(1,71);
for t=2:71
    survival(t) = (1-death_(t-1));
end
mydata.survival = survival;

save('recalibrated_data','mydata')
